//
//  EmoticonCell.swift
//  表情键盘
//
//  Created by 叶子韬韬 on 2017/5/11.
//  Copyright © 2017年 叶子韬韬. All rights reserved.
//

import UIKit

class EmoticonCell: UICollectionViewCell {
    var emoticon:Emoticon?{
        didSet{
            guard let emoticon = emoticon  else {
                return
            }
            
            //
            emoticonBtn.setImage(UIImage(named: emoticon.pngPath ?? ""), for: .normal)
            emoticonBtn.setTitle(emoticon.emojiCode, for: .normal)
            
            //设置删除按钮
            if emoticon.isRemove {
                emoticonBtn.setImage(UIImage(named: "compose_emotion_delete"), for: .normal)
            }
        }
        
        
    }
    
    internal lazy var emoticonBtn : UIButton = UIButton()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("sasa")
    }
}
extension EmoticonCell{
    
    internal func setupUI(){
        
        addSubview(emoticonBtn)
        
        emoticonBtn.frame = contentView.frame
        emoticonBtn.isUserInteractionEnabled = false
        emoticonBtn.titleLabel?.font = UIFont.systemFont(ofSize: 32)
        
    }
    
}
